﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Domelist.aspx.cs" Inherits="PropertyAppraisal.DoemsKanCha.Domelist" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>

    <link href="../jquery-easyui-1.3.5/themes/default/easyui.css" rel="stylesheet" />
    <link type="/text/css" href="../jquery-easyui-1.3.5/themes/icon.css" rel="stylesheet" />

    <%--<script type="text/javascript" src="easyui/js/jquery-1.8.0.min.js"></script>--%>

    <script type="text/javascript" src="../jquery-easyui-1.3.5/jquery-1.7.2-min.js"></script>
    <script type="text/javascript" src="../jquery-easyui-1.3.5/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../jquery-easyui-1.3.5/easyloader.js"></script>

    <script type="text/javascript" src="../easyui/jquery.params.js"></script>
</head>
<body id="zhi">
    <div>
        <a href="javascript:void(0) " class="easyui-linkbutton" onclick="quwei()" >区位状况勘察</a>&nbsp;
        <a href="javascript:void(0) " class="easyui-linkbutton" onclick="xiaoqu()" >小区状况勘察</a>&nbsp;
        <a href="javascript:void(0) " class="easyui-linkbutton" onclick="lou()" >楼状况勘察</a>&nbsp;
        <a href="javascript:void(0) " class="easyui-linkbutton" onclick="xunjia()" >询价记录</a>&nbsp;
        <a href="javascript:void(0) " class="easyui-linkbutton" onclick="xiang()" >详情</a>&nbsp;
        <a href="javascript:void(0) " class="easyui-linkbutton" >审核详情</a>&nbsp;
     <a href="javascript:void(0)" class="easyui-linkbutton" onclick="indoor()">室内勘察</a>
     <a href="javascript:void(0)" class="easyui-linkbutton" onclick="Photo()">现场照片提供</a>

    </div>
    <div style="padding: 3px">
        <select class="easyui-combobox" id="select1">
            <option>所属部门</option>
        </select>
        <select class="easyui-combobox" id="select2">
            <option>请选择</option>
        </select>
        <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search',toggle:true" onclick="doSearch()">查询</a>
    </div>
    <table id="ta" title="勘察列表" style="width: 900px; height: 300px" data-options="
				
				singleSelect:true,
				autoRowHeight:false,
				pagination:true,
				pageSize:10">
        <thead>
            <tr>
                <th field="chek" width="50"></th>
                <th field="inv" width="110">项目号</th>
                <th field="date" width="100">所属部门</th>
                <th field="name" width="100">借款人</th>
                <th field="amount" width="100">借款人电话</th>
                <th field="price" width="100">贷款额度</th>
                <th field="cost" width="110">登记日期</th>
                <th field="note" width="110">项目状态</th>
                <th field="cao" width="110">操作</th>
            </tr>
        </thead>
    </table>


    <script>

        //跳转详情页面
        function datalis(domeId) {
            parent.addTab("详细信息", "/DoemsKanCha/DomeDatalis.aspx?id=" + domeId, "icon-chart-organisation", true);
        }

        //跳转详情页面
        function xiang() {
            var chek = "";
            $(":checkbox:checked").each(function () {
                chek += $(this).val();
            })
            if (chek.length != 1) {
                $.messager.alert("", "每次只能勘察一个项目！");
            }
            else {
                var xiangId = $(":checkbox:checked").parent().parent().parent().children().eq(1).children().children().html();
                parent.addTab("详细信息", "/DoemsKanCha/DomeDatalis.aspx?id=" + xiangId, "icon-chart-organisation", true);
            }
        }

        //跳转楼状况勘察
        function lou() {
            var chek = "";
            $(":checkbox:checked").each(function () {
                chek += $(this).val();
            })
            if (chek.length != 1) {
                $.messager.alert("", "每次只能勘察一个项目！");
            }
            else {
                var xiangId = $(":checkbox:checked").parent().parent().parent().children().eq(1).children().children().html();
                parent.addTab("建筑公共部分状况勘察", "/DoemsKanCha/DomeLou.aspx?id=" + xiangId, "icon-chart-organisation", true);
            }
        }

        //跳转小区状况勘察
        function xiaoqu() {
            var chek = "";
            $(":checkbox:checked").each(function () {
                chek += $(this).val();
            })
            if (chek.length != 1) {
                $.messager.alert("", "每次只能勘察一个项目！");
            }
            else {
                var xiangId = $(":checkbox:checked").parent().parent().parent().children().eq(1).children().children().html();
                parent.addTab("小区状况勘察", "/DoemsKanCha/DomeXiaoqu.aspx?id=" + xiangId, "icon-chart-organisation", true);
            }
        }

        //跳转询价页面
        function xunjia() {
            var chek = "";
            $(":checkbox:checked").each(function () {
                chek += $(this).val();
            })
            if (chek.length != 1) {
                $.messager.alert("", "每次只能勘察一个项目！");
            }
            else {
                var xiangId = $(":checkbox:checked").parent().parent().parent().children().eq(1).children().children().html();
                parent.addTab("询价列表", "/DoemsKanCha/XunJia.aspx?id=" + xiangId, "icon-chart-organisation", true);
            }
        }


        //跳转室内勘察页面
        function indoor() {
            var chek = "";
            $(":checkbox:checked").each(function () {
                chek += $(this).val();
            })
            if (chek.length != 1) {
                $.messager.alert("", "每次只能勘察一个项目！");
            }
            else {
                var xiangId = $(":checkbox:checked").parent().parent().parent().children().eq(1).children().children().html();
                parent.addTab("室内勘察", "/DoemsKanCha/DomeIndoor.aspx?id=" + xiangId, "icon-chart-organisation", true);
            }
        }
        //跳转现场照片提供页面
        function Photo() {
            var chek = "";
            $(":checkbox:checked").each(function () {
                chek += $(this).val();
            })
            if (chek.length != 1) {
                $.messager.alert("", "每次只能勘察一个项目！");
            }
            else {
                var xiangId = $(":checkbox:checked").parent().parent().parent().children().eq(1).children().children().html();
                parent.addTab("现场照片提供", "/DoemsKanCha/DomePhoto.aspx?id=" + xiangId, "icon-chart-organisation", true);
            }
        }

        //结束勘察
        function jieshu(id) {
            $.ajax({
                type: "post", //要用post方式                 
                url: "Domelist.aspx/updState",//方法所在页面和方法名
                contentType: "application/json; charset=utf-8",
                data: "{'id':'" + id + "'}",
                dataType: "json",
                success: function (result) {
                    if (result) {
                        $.messager.alert("结束勘察", "操作成功");
                    }


                }
            });
        }
        ///区位勘察
        function quwei() {
            var chek = "";
            $(":checkbox:checked").each(function () {
                chek += $(this).val();
            })
            if(chek.length!=1)
            {
                $.messager.alert("","每次只能勘察一个项目！");
            }
            else
            {
                var xiangId = $(":checkbox:checked").parent().parent().parent().children().eq(1).children().children().html();
                parent.addTab("区位状况勘察", "/DoemsKanCha/DomeQuwei.aspx?id=" + xiangId, "icon-chart-organisation", true);
            }

        }

        //表格
        function getData() {
            var rows = [];
            $.ajax({
                type: "post", //要用post方式                 
                url: "Domelist.aspx/showKanCha",//方法所在页面和方法名
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                async: false,
                success: function (result) {
                    var json = eval("(" + result.d + ")");
                    for (var i = 0; i < json.length; i++) {
                        rows.push({
                            chek: '<input type="checkbox" value="1"/>',
                            inv: '<a href="javascript:void(0)" onclick="datalis(' + json[i].projectNumber + ')" >' + json[i].projectNumber + '</a>',
                            date: json[i].department_Name, //$.fn.datebox.defaults.formatter(new Date()),
                            name: json[i].loan_Name,
                            amount: json[i].loan_TEL,
                            price: json[i].basic_Quota,
                            cost: json[i].basic_CreateTime,
                            note: json[i].basic_State == 0 ? "保存未提交" : json[i].basic_State == 1 ? "已提交/待勘察" : json[i].basic_State == 2 ? "勘察中" : json[i].basic_State == 3 ? "已勘察/待评估" : json[i].basic_State == 4 ? "评估进行中" : json[i].basic_State == 5 ? "已评估/待初审" : json[i].basic_State == 6 ? "初审未通过" : json[i].basic_State == 7 ? "初审通过" : json[i].basic_State == 8 ? "终审未通过" : "终审通过",
                            cao: json[i].basic_State == 1 ? '<a HREF = "#" class= "easyui-linkbutton" onclick="jieshu(' + json[i].projectNumber + ')">结束勘察</a> ' : json[i].basic_State == 9 ? '<a HREF = "#" class= "easyui-linkbutton"> 导出</a>' : "",
                        });
                    }
                }
            })
            return rows;
        }

        function pagerFilter(data) {
            if (typeof data.length == 'number' && typeof data.splice == 'function') {	// is array
                data = {
                    total: data.length,
                    rows: data
                }
            }
            var dg = $(this);
            var opts = dg.datagrid('options');
            var pager = dg.datagrid('getPager');
            pager.pagination({
                onSelectPage: function (pageNum, pageSize) {
                    opts.pageNumber = pageNum;
                    opts.pageSize = pageSize;
                    pager.pagination('refresh', {
                        pageNumber: pageNum,
                        pageSize: pageSize
                    });
                    dg.datagrid('loadData', data);
                }
            });
            if (!data.originalRows) {
                data.originalRows = (data.rows);
            }
            var start = (opts.pageNumber - 1) * parseInt(opts.pageSize);
            var end = start + parseInt(opts.pageSize);
            data.rows = (data.originalRows.slice(start, end));
            return data;
        }

        $(function () {
            $('#ta').datagrid({ loadFilter: pagerFilter }).datagrid('loadData', getData());
        });
    </script>
</body>
</html>
